package cums.db.impl;

import cums.db.iface.CuspropDao;
import cums.db.pers.Cusprop;
import java.util.List;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 * @time Dec 9, 2009, 1:04:05 PM
 * @author fdcube
 */
public class CuspropImpl extends HibernateDaoSupport implements CuspropDao {

    public Cusprop AddOrUpdateCusprop(Cusprop value) {
        this.getHibernateTemplate().save(value);
        return value;
    }

    public boolean DeleteCustprop(Cusprop value) {
        try {
            this.getHibernateTemplate().delete(value);
            return true;
        } catch (DataAccessException dataAccessException) {
            logger.error(dataAccessException);
            return false;
        }
    }

    public List<Cusprop> FindCuspropByCpId(int value) {
        return this.getHibernateTemplate().findByNamedParam("FROM CUSPROP AS cp WHERE cp.cpid =:value", "value", value);
    }
}
